package processors

import (
	"fmt"
	"go-demo/designpattern/templatemethod/ordercenter"
)

type StandardOrderProcessor struct {
	DefaultOrderProcessor
}

// 实现钩子方法
func (p *StandardOrderProcessor) BeforeProcess(order *ordercenter.Order) {
	fmt.Println("=== 开始处理普通订单 ===")
}

func (p *StandardOrderProcessor) AfterProcess(order *ordercenter.Order) {
	fmt.Println("=== 普通订单处理完成 ===")
}

// 实现处理接口
func (p *StandardOrderProcessor) Process(order *ordercenter.Order) error {
	p.BeforeProcess(order)
	defer p.AfterProcess(order)
	
	return ordercenter.ProcessOrder(order, p)
}
